package com.ruoqing.blog.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoqing.blog.dao.RuoXiRecommendDao;
import com.ruoqing.blog.service.api.RecommendService;
import com.ruoqing.core.constant.Constants;
import com.ruoqing.core.domain.rqblog.RuoXiRecommendPo;
import com.ruoqing.core.vo.blog.BlogResponseVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
	* @author YaoXian
	* @title: RecommendServiceImpl
	* @projectName ruoxi-blog
	* @description: 若兮微服务 -
	* @date 2021-02-26 20:45
	*/
@Service
public class RecommendServiceImpl implements RecommendService {
		
		@Resource
		private RuoXiRecommendDao ruoXiRecommendDao;
		
		public BlogResponseVo recommendBlog(String type) {
				String status;
				QueryWrapper<RuoXiRecommendPo> queryWrapper = new QueryWrapper<RuoXiRecommendPo>();
				if ("focus".equals(type) || "especially".equals(type)){
						queryWrapper.eq("type",type);
						status = Constants.responseOk;
						return BlogResponseVo.buildBlogResponseVo(status,ruoXiRecommendDao.selectList(queryWrapper));
				}else {
						status = Constants.responseError;
						return BlogResponseVo.buildBlogResponseVo(status);
				}
		}
}
